package com.rainy.upload.entity;

import com.rainy.upload.exception.ExceptionCode;
import lombok.Data;

@Data
public class ResultMessage {

    /**
     * 200表示成功，其他表示失败
     */
    private String code;

    /**
     * 错误信息
     */
    private String errMsg;

    /**
     * 返回数据
     */
    private Object data;

    public ResultMessage() {
    }

    public ResultMessage(String code, String errMsg, Object data) {
        this.code = code;
        this.errMsg = errMsg;
        this.data = data;
    }

    public static ResultMessage newInstance(String code, String errMsg, Object data) {
        return new ResultMessage(code, errMsg, data);
    }

    public static ResultMessage newInstanceNotErr(Object data) {
        return new ResultMessage(ExceptionCode.NO_EXCEPTION_CODE, "", data);
    }
}
